//
//  BaseTableViewController.swift
//  weibo117
//
//  Created by 宋禹奇 on 15/6/24.
//  Copyright © 2015年 宋禹奇. All rights reserved.
//

import UIKit

class BaseTableViewController: UITableViewController,VisitorLoginViewDelegate {

    //记录用户登录标记
    var UserLogin = true
    
    //定义访客视图
    var visitorView: VisitorLoginView?
    
    //重写loadView
    override func loadView() {
        
        UserLogin = false
        
        
        //判断是否登录返回哪个界面
        UserLogin ? super.loadView() : setupVistorView()
        
        
    }
    

    private func setupVistorView(){
    
    //实例化访客视图
        visitorView = VisitorLoginView()
        
        visitorView?.delegate = self
        
        view = visitorView!
        
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "登录", style: UIBarButtonItemStyle.Plain, target:self , action: "visitorLoginButtonClicked")
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle.Plain, target: self, action: "visitorRegisterButtonClicked")
        
    
    }
    
    func visitorLoginButtonClicked() {
        print("登录")
    }
   
    func visitorRegisterButtonClicked() {
        print("注册")
        
    }
}
